package c.a.a.z.b;

import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Path;
import android.graphics.RectF;
import c.a.a.b0.e;
import c.a.a.b0.k.k;
import c.a.a.e0.f;
import c.a.a.f0.c;
import c.a.a.l;
import c.a.a.q;
import c.a.a.z.c.a;
import c.a.a.z.c.a.b;
import c.a.a.z.c.o;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;

/* compiled from: RepeaterContent */
public class p implements e, m, j, b, k {
    public final Matrix a = new Matrix();
    public final Path b = new Path();
    public final l c;
    public final c.a.a.b0.l.b d;
    public final String e;
    public final boolean f;
    public final a<Float, Float> g;
    public final a<Float, Float> h;
    public final o i;
    public d j;

    public p(l lVar, c.a.a.b0.l.b bVar, k kVar) {
        this.c = lVar;
        this.d = bVar;
        this.e = kVar.a;
        this.f = kVar.e;
        a a = kVar.b.a();
        this.g = a;
        bVar.e(a);
        a.a.add(this);
        a = kVar.c.a();
        this.h = a;
        bVar.e(a);
        a.a.add(this);
        c.a.a.b0.j.l lVar2 = kVar.d;
        Objects.requireNonNull(lVar2);
        o oVar = new o(lVar2);
        this.i = oVar;
        oVar.a(bVar);
        oVar.b(this);
    }

    public String a() {
        return this.e;
    }

    public void b(RectF rectF, Matrix matrix, boolean z) {
        this.j.b(rectF, matrix, z);
    }

    public void c() {
        this.c.invalidateSelf();
    }

    public void d(List<c> list, List<c> list2) {
        this.j.d(list, list2);
    }

    public void e(ListIterator<c> listIterator) {
        if (this.j == null) {
            while (listIterator.hasPrevious() && listIterator.previous() != this) {
            }
            ArrayList arrayList = new ArrayList();
            while (listIterator.hasPrevious()) {
                arrayList.add(listIterator.previous());
                listIterator.remove();
            }
            Collections.reverse(arrayList);
            this.j = new d(this.c, this.d, "Repeater", this.f, arrayList, null);
        }
    }

    public void f(e eVar, int i, List<e> list, e eVar2) {
        f.f(eVar, i, list, eVar2, this);
    }

    public void g(Canvas canvas, Matrix matrix, int i) {
        float floatValue = ((Float) this.g.e()).floatValue();
        float floatValue2 = ((Float) this.h.e()).floatValue();
        float floatValue3 = ((Float) this.i.m.e()).floatValue() / 100.0f;
        float floatValue4 = ((Float) this.i.n.e()).floatValue() / 100.0f;
        for (int i2 = ((int) floatValue) - 1; i2 >= 0; i2--) {
            this.a.set(matrix);
            float f = (float) i2;
            this.a.preConcat(this.i.f(f + floatValue2));
            this.j.g(canvas, this.a, (int) (f.e(floatValue3, floatValue4, f / floatValue) * ((float) i)));
        }
    }

    public Path h() {
        Path h = this.j.h();
        this.b.reset();
        float floatValue = ((Float) this.g.e()).floatValue();
        float floatValue2 = ((Float) this.h.e()).floatValue();
        for (int i = ((int) floatValue) - 1; i >= 0; i--) {
            this.a.set(this.i.f(((float) i) + floatValue2));
            this.b.addPath(h, this.a);
        }
        return this.b;
    }

    public <T> void i(T t, c<T> cVar) {
        if (!this.i.c(t, cVar)) {
            a aVar;
            c cVar2;
            if (t == q.q) {
                aVar = this.g;
                cVar2 = aVar.e;
                aVar.e = cVar;
            } else if (t == q.r) {
                aVar = this.h;
                cVar2 = aVar.e;
                aVar.e = cVar;
            }
        }
    }
}
